package com.c.result;

public class SingleResult<T> extends BaseResult<T> {
	private static final long serialVersionUID = 8172315972492346878L;
	/** Query result */
	private T data;

	/**
	 * Single query result
	 */
	public SingleResult() {
		this(true, "", null);
	}

	/**
	 * Single query result
	 */
	public SingleResult(boolean success, String message) {
		this(success, message, null);
	}

	/**
	 * Single query result
	 */
	public SingleResult(boolean success, String message, T data) {
		super(success, message);
		this.data = data;
	}

	/**
	 * Get query result
	 * 
	 * @return Query item
	 */
	public T getData() {
		return data;
	}

	/**
	 * Set query result
	 * 
	 * @param data
	 *            - Query item
	 */
	public void setData(T data) {
		this.data = data;
	}

	public SingleResult<T> appendJsonIncludes(String... propNames) {
		for (String propName : propNames) {
			get_jsonSer().include(propName);
		}
		return this;
	}

	public SingleResult<T> appendJsonExcludes(String... propNames) {
		for (String propName : propNames) {
			get_jsonSer().exclude(propName);
		}
		return this;
	}
}
